package com.logictech.lims.dao.impl;

import java.util.List;

import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.jeecgframework.p3.core.utils.common.PageQueryWrapper;
import org.jeecgframework.p3.core.utils.persistence.mybatis.GenericDaoDefault;
import org.springframework.stereotype.Repository;
import com.logictech.lims.dao.GlasswareDao;
import com.logictech.lims.dto.GlasswareDto;
import com.logictech.lims.entity.Glassware;

/**
 * 描述：</b>GlasswareDaoImpl<br>
 * @author：guoqi
 * @since：2017年03月23日 13时02分39秒 星期四 
 * @version:1.0
 */
@Repository("glasswareDao")
public class GlasswareDaoImpl extends GenericDaoDefault<Glassware> implements GlasswareDao{

	@Override
	public Integer count(PageQuery<GlasswareDto> pageQuery) {
		return (Integer) super.queryOne("count",pageQuery);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<GlasswareDto> queryPageList(
		PageQuery<GlasswareDto> pageQuery,Integer itemCount) {
		PageQueryWrapper<Glassware> wrapper = new PageQueryWrapper<Glassware>(pageQuery.getPageNo(), pageQuery.getPageSize(),itemCount, pageQuery.getQuery());
		return (List<GlasswareDto>)super.query("queryPageList",wrapper);
	}

	public int getMaxNo(String no){
		String maxNo = (String) super.queryOne("getMaxNo",no);
		if(maxNo == null){
			return 0;
		}
		return Integer.parseInt(maxNo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<GlasswareDto> queryList(PageQuery<GlasswareDto> pageQuery) {
		return (List<GlasswareDto>)super.query("queryList",pageQuery);
	}

	@Override
	public Integer countByNo(String no) {
		return (Integer)super.queryOne("countByNo",no);
	}
}

